<template>
  <div id="app">
    <!--
    <div id="nav">
        <router-link to="/">Home</router-link> |
        <router-link to="/about">About</router-link>
    </div>
    -->
    <router-view />
  </div>
</template>

<script>
export default {
  name: 'App',
  watch: {
    // 对于刷新页面，将链接地址重新添加到store的tabs中
    $route(to, from) {
      //console.log('to', to)
      //console.log(this.$store.state.menus.editableTabs)
      if (to.path != '/login') {
        // 从默认路由跳转过来没有title，首页已默认写入common-tab ，仅当人工切换nav时候才执行该方法
        if (to.meta.title) {
          let obj = {
            name: to.name,
            title: to.meta.title,
          }
          this.$store.commit('addTab', obj)
        }
      }
    },
  },
}
</script>

<style lang="scss">
html,
body,
#app {
  font-family: 'Helvetica Neue', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', 'Microsoft Yahei', sans-serif;
  height: 100%;
  padding: 0;
  margin: 0;
  font-size: 15px;
}
</style>
